package com.shop.cereshop.admin.controller.im;

import com.shop.cereshop.admin.page.im.ImSingleMsgVO;
import com.shop.cereshop.admin.service.im.ImService;
import com.shop.cereshop.commons.result.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: wang.yao
 * 即时通讯控制器
 */
@RestController
@RequestMapping("/im")
@Api(tags = "即时通讯")
public class ImController {
    @Resource
    private ImService imService;


    /**
     * 用户信息推送到腾讯即时通讯服务器
     */
    @PostMapping("/pushUserInfo")
    public Result<Integer> pushUserInfo() {
        return new Result<>(imService.pushUserInfo());
    }

    /**
     * 根据用户id查询单聊记录
     */
    @PostMapping("/getSingleMsg")
    public Result<ImSingleMsgVO> getSingleMsg(String fromAccount, String toAccount) {
        return new Result<>(imService.getSingleMsg(fromAccount, toAccount));
    }
}
